﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;

namespace MyHttp.validator
{
    public class StringValidator
    {
        public static String validateRegex(String str, String pattern)
        {
            if (null == str) return null;
            return Regex.IsMatch(str, pattern) ? str : null;
        }

        public static String validateMaxLength(String str, UInt32 maximum)
        {
            if (null == str) return null;
            return str.Length > maximum ? null : str;
        }

        public static String validateMinLength(String str, UInt32 minimum)
        {
            if (null == str) return null;
            return str.Length < minimum ? null : str;
        }
    }
}
